# 设置编码
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

Write-Host "1. 安装依赖..." -ForegroundColor Green
ohpm install | Tee-Object -FilePath "build.log"
if ($LASTEXITCODE -ne 0) {
    Write-Host "依赖安装失败！" -ForegroundColor Red
    exit 1
}

Write-Host "`n2. 编译项目..." -ForegroundColor Green
hvigorw assembleApp | Tee-Object -FilePath "build.log" -Append
if ($LASTEXITCODE -ne 0) {
    Write-Host "编译失败！" -ForegroundColor Red
    exit 1
}

Write-Host "`n3. 执行部署..." -ForegroundColor Green
& .\run.ps1 | Tee-Object -FilePath "build.log" -Append
if ($LASTEXITCODE -ne 0) {
    Write-Host "部署失败！" -ForegroundColor Red
    exit 1
}

Write-Host "`n✅ 完成！" -ForegroundColor Green

